<?php

namespace app\controller\bossManager;

use app\validate\PageValidate;
use app\validate\AliyunProjectValidate;
use app\service\AliyunProjectService;

class AliyunProjectController extends WebBossController{
    public function initValidate(){        
        $this->validate = new AliyunProjectValidate();
    }

    public function list_action(){  
        $input = $this->check();        
        $page = $this->check('pageInfo',null,(new PageValidate()));        
        $data = AliyunProjectService::getListInfo($input,$page);
        $total = AliyunProjectService::getListCountInfo($input);
        return self::ok(self::formatPageData($page,$total,$data));    
    }

    public function set_action(){  
        $input = $this->check();
        $res = AliyunProjectService::edit($input); 
        return self::ok($res);
    }

 
    public function del_action(){ 
        $input = $this->check();
        $res = AliyunProjectService::delById($input['id']); 
        return self::ok($res);
    }

    public function simple_all_action(){
        $data = AliyunProjectService::getNativeAll([],['id','name','project_key']);
        return self::ok($data); 
    }
}